package com.chujian.wx.entity;

import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.chujian.framework.core.IId;
import com.chujian.framework.core.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;

/**
 * @author chujian
 * @since 2021-10-14
 */
@Getter
@Setter
@ToString
@Accessors(chain = true)
@TableName("wx_token")
@KeySequence("wx_token_seq")
@ApiModel(value = "实体", description = "")
public class WxToken extends BaseEntity implements IId, Serializable {

    private static final long serialVersionUID = 1L;

    @TableId("token_id")
    private Long tokenId;

    @ApiModelProperty(value = "token")
    @TableField("token")
    private String token;

    @ApiModelProperty(value = "账号类型：1小程序 2公众号")
    @TableField("account_type")
    private Integer accountType;

    @ApiModelProperty(value = "账号名称")
    @TableField("account_name")
    private String accountName;

    @ApiModelProperty(value = "状态")
    @TableField("status")
    private Integer status;

    @ApiModelProperty(value = "appid")
    @TableField("app_id")
    private String appId;

    @ApiModelProperty(value = "失效时间")
    @TableField("expires_date")
    private LocalDateTime expiresDate;

    @ApiModelProperty(value = "失效时间")
    @TableField("express_in")
    private Integer expressIn;

    @ApiModelProperty(value = "错误码")
    @TableField("err_code")
    private Integer errCode;

    @ApiModelProperty(value = "错误信息")
    @TableField("err_msg")
    private String errMsg;


    // ++++++ 系统拓展 +++++++
    @TableField(exist = false)
    private Map<String, String> query = new HashMap<>();

    @Override
    public Long getId() {
        return this.tokenId;
    }

    @Override
    public void setId(Serializable id) {
        if (null != id) {
            this.tokenId = Long.parseLong("" + id);
        }
    }

    // ++++++ 业务拓展 +++++++
}
